<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      function caiquan(min, max) {
        return Math.floor(Math.random() * (max - min + 1) + min);
      }
      var compute = caiquan(1, 3); //1、2、3分别表示石头、剪刀、布
      var user = prompt("请输入一个1-3的数字代表石头、剪刀、布");

      if (user == 1) {
        if (compute == 1) {
          alert("这是平局");
        } else if (compute == 2) {
          alert("恭喜您，您赢拉");
        } else if (compute == 3) {
          alert("嘻嘻，不好意思，你输拉");
        }
      } else if (user == 2) {
        if (compute == 1) {
          alert("嘻嘻，不好意思，你输拉");
        } else if (compute == 2) {
          alert("这是平局");
        } else if (compute == 3) {
          alert("恭喜您，您赢拉");
        }
      } else if (user == 3) {
        if (compute == 1) {
          alert("恭喜您，您赢拉");
        } else if (compute == 2) {
          alert("嘻嘻，不好意思，你输拉");
        } else if (compute == 3) {
          alert("这是平局");
        }
      } else {
        alert("只能输入1-3的一个数字奥");
      }
    </script>
  </body>
</html>
